package io.adrainty.bolee.security.feign.impl;

import io.adrainty.bolee.framework.commons.basic.ResultDTO;
import io.adrainty.bolee.framework.commons.user.UserEntity;
import io.adrainty.bolee.framework.commons.utils.ResultDTOUtil;
import io.adrainty.bolee.security.feign.ICustomerFeign;
import io.adrainty.bolee.security.models.entity.CustomerEntity;
import io.adrainty.bolee.security.models.valobj.UserTypeEnum;
import io.adrainty.bolee.security.service.IUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * <p>CustomerFeignImpl</p>
 *
 * @author AdRainty
 * @version V1.0.0
 * @description CustomerFeignImpl
 * @since 2025/8/7 11:22:59
 */

@Slf4j
@RestController
@Tag(name = "顾客接口")
@RequestMapping("/customer-feign")
public class CustomerFeignImpl implements ICustomerFeign {

    @Resource
    private IUserService userService;

    @Override
    @Operation(summary = "按照用户名查找用户")
    @PostMapping("/username-login/{username}/{company}")
    public ResultDTO<UserEntity> usernameLogin(@PathVariable("username") String username,  @PathVariable("company") String company) {
        return null;
    }

    @Override
    @Operation(summary = "按照手机号查找用户")
    @PostMapping("/mobile-login/{mobile}/{company}")
    public ResultDTO<UserEntity> mobileLogin(@PathVariable("mobile") String mobile,  @PathVariable("company") String company) {
        UserEntity userEntity = userService.findUserByMobile(UserTypeEnum.CUSTOMER, mobile, company);
        return ResultDTOUtil.success(userEntity);
    }

    @Override
    @Operation(summary = "微信登录")
    @PostMapping("/wechat-login/{openId}/{company}")
    public ResultDTO<UserEntity> wechatLogin(@PathVariable("openId") String openId,  @PathVariable("company") String company) {
        return null;
    }

    @Override
    @Operation(summary = "注册用户")
    @PostMapping("/register-user")
    public ResultDTO<UserEntity> registerUser(@RequestBody CustomerEntity customerVO) {
        return null;
    }

    @Override
    @Operation(summary = "重置密码")
    @PostMapping("reset-passwords/{customerId}")
    public ResultDTO<Boolean> resetPasswords(@PathVariable("customerId") String customerId) {
        return null;
    }

    @Override
    @Operation(summary = "更新真实姓名")
    @PostMapping("/update-real-name")
    public ResultDTO<Boolean> updateRealName(@RequestParam("userId") String userId, @RequestParam("name") String name) {
        return null;
    }
}
